<?php

/**
 * 开店控制器
 * Class open_storeControl
 */

 Class open_storeControl extends BaseHomeControl{

       // 开店首页
       public function indexOp()
       {
           $model_class = Model('goods_class');
           $total_page = pagecmd('gettotalpage');
           if (intval($_GET['curpage'] > $total_page)) {
               exit();
           }
           $condition['isshow'] = 0;
           $condition['is_open'] = 1;
           $goods_class = $model_class->getGoodsClassList($condition, 'gc_id');
           $gc_idstr = '';
           foreach($goods_class as $k => $v){
               $gc_idstr .= $v['gc_id'].',';
           }
           $where['gc_id'] = array('in',trim($gc_idstr));
           $where['goods_state'] = 1;
           $data = Model('goods')->getGoodsList($where);
           foreach($data as $k => $v){
                 $data[$k]['image_url_240'] = cthumb($v['goods_image'], 240, $v['store_id']);
           }
           Tpl::output('total_page',pagecmd('gettotalpage'));
           Tpl::output('goods_list',$data);
           Tpl::showpage("open_store.list");
       }
 }
?>